package com.gxa.meiye.admin.controller.lzj;


import com.gxa.meiye.admin.service.ConsumerLocationService;
import com.gxa.meiye.core.common.ResponseData;
import com.gxa.meiye.core.pojo.domain.lzj.Location;
import com.gxa.meiye.core.pojo.vo.UserLocationVO;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@Api(value = "Consumer",tags = "消费者地址接口")
public class ConsumerLocationController {

    @Autowired
    private ConsumerLocationService consumerLocationService;

    //查询地址
    @ResponseBody
    @GetMapping("/location/check")
    public ResponseData queryAll(String phone){
        return consumerLocationService.queryByPhone(phone);
    }



    //添加地址
    @ResponseBody
    @PostMapping("/location/add")
        public ResponseData addlocation(String usephone, Location location){
        //return CommentService.add(commentVO);
        return consumerLocationService.addLocation(usephone,location);
    }

    //修改地址信息
    @ResponseBody
    @PostMapping("/location/update")
    public ResponseData updatelocation(UserLocationVO userLocationVO){
        //return CommentService.add(commentVO);
        return consumerLocationService.updateLocation(userLocationVO);
    }

    //删除地址信息
    @ResponseBody
    @PostMapping("/location/delete")
    public ResponseData delectlocation(Integer[] ids){
        //return CommentService.add(commentVO);
        return consumerLocationService.delLocation(ids);
    }


}
